libxl: Avoid fd leak of qemu state fd during migration
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 16 Oct 2014 17:44:13 +0000 (18:44 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 20 Oct 2014 12:51:27 +0000 (13:51 +0100)
commit3091ae8de31fd65432d0e2d3b2b31b9042225f48
tree236300933d81eaf8608a5c9c67bfa5b753c3e3a8
parent916d33f787fb0935a07257fc11bcbb3ddfa6eb08
libxl: Avoid fd leak of qemu state fd during migration

In a long-running process (such as virt-manager) this might eventually
run the process out of fds.

That qemu argument construction might generate an fd that needs to be
fed to qemu is a bit odd, but we just run with it and provide a
parameter to the qemu argument construction code for this purpose.

There is no need to use the carefd machinery, because leaking the odd
copy of this descriptor into a child unexpectedly forked out of
another thread, is fine.  We just don't want to leak it back to the
main process.

Reported-by: ustermann.max@web.de
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_dm.c